<template>
  <div class="in-master-print" ref="print">
    <div class="print-mid">
      <div class="mid-l">
        <h3>{{ title }}</h3>
        <h2>{{ printData.workTypeTran }}</h2>
        <p>
          <label>单据编码：</label>
          <span>{{ printData.prsCode }}</span>
        </p>
        <p>
          <label>单据日期：</label>
          <span>{{ printData.invoiceDate }}</span>
        </p>
        <p>
          <label>单据状态：</label>
          <span>{{ printData.invoiceStatus | getInvoice }}</span>
        </p>
        <p>
          <label>业务状态：</label>
          <span>{{ printData.workStatus }}</span>
        </p>
      </div>
      <div class="mid-m">
        <p>
          <label>仓库：</label>
          <span>{{ printData.warehouse }}</span>
        </p>
        <p>
          <label>销售单号：</label>
          <span>{{ printData.ppNumber }}</span>
        </p>
          <p>
          <label>订单交期：</label>
          <span>{{ printData.ppDate |inMaterTime}}</span>
        </p>
        <p>
          <label>备注信息：</label>
          <span>{{ printData.remarks }}</span>
        </p>
      </div>
      <div class="mid-m">
        <p>
          <label>物料编码：</label>
          <span>{{ printData.invCode }}</span>
        </p>
        <p>
          <label>物料名称：</label>
          <span>{{ printData.invName }}</span>
        </p>
        <p>
          <label>规格型号：</label>
          <span>{{ printData.invAttribute }}</span>
        </p>
            <p>
          <label>计量单位：</label>
          <span>{{ printData.unitName }}</span>
        </p>
      </div>
        <div class="mid-m">
        <p>
          <label>计划单号：</label>
          <span>{{ printData.mpOrderCode }}</span>
        </p>
        <p>
          <label>生产线：</label>
          <span>{{ printData.beltline }}</span>
        </p>
        <p>
          <label>完工数量：</label>
          <span>{{ printData.invQuantity }}</span>
        </p>
      </div>
      <div class="mid-r">
        <vue-qr
          :logoScale="20"
          :text="qrCodeValue"
          :margin="0"
          :dotScale="1"
        ></vue-qr>
      </div>
    </div>
    <div class="print-bot">
      <div class="bot-l">
        <label>制单人：</label>
        <span>{{ printData.userOper }}</span>
      </div>
      <div class="bot-m">
        <label>审核人：</label>
        <span>{{ printData.userCheck }}</span>
      </div>
      <div class="bot-r">
        <label>打印日期：</label>
        <span>{{ printData.printTime }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import vueQr from "vue-qr";
export default {
  data() {
    return {};
  },
  props: {
    // 打印数据
    printData: {
      type: Object,
      default() {
        return {};
      },
    },
    // 标题
    title: {
      type: String,
      default() {
        return "入库单";
      },
    },
    priceStatus: {
      type: Boolean,
      default: false,
    },

    // 二维码内容
    qrCodeValue: {
      type: String,
      default() {
        return "";
      },
    },
  },
  components: {
    vueQr,
  },
  filters: {
    getInvoice(status) {
      switch (status) {
        case "0":
          return "开立";
          break;
        case "1":
          return "审核";
          break;
        case "2":
          return "退回";
          break;
        default:
          return "无";
      }
    },
    inMaterTime(date) {
      let time = new Date(date);
      return (
        time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate()
      );
    },
  },
};
</script>

<style lang="scss" scoped="scoped">
</style>
